<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
	<th:block th:include="include :: header('设置阀门开度')" />
</head>
<body class="white-bg">
	<div class="wrapper wrapper-content animated fadeInRight ibox-content">
		<form class="form-horizontal m" id="form-data-aperture">
			<input id="collectorId" name="collectorId" type="hidden" th:value="${collectorId}" />
			<div class="form-group">
				<label class="col-sm-3 control-label">阀门开度：</label>
				<div class="col-sm-8">
					<input class="form-control" type="number" placeholder="设置阀门开度0~100之间" name="aperture" id="aperture" th:min="0" th:max="100" required>
				</div>
			</div>
		</form>
	</div>
	<th:block th:include="include :: footer" />
	<script type="text/javascript">
		var prefix = ctx + "base/collector/info";

		$("#form-data-aperture").validate({
			focusCleanup: true
		});
		
		function submitHandler() {
			if ($.validate.form()) {
				var formData = $('#form-data-aperture').serialize();
				$.ajax({
					url: prefix + "/aperture",
					type: 'post',
					dataType: "json",
					data: formData,
					beforeSend: function () {
						$.modal.loading("正在处理中，请稍后...");
					//	$.modal.disable();
					},
					success: function (result) {
						if (result.code == web_status.SUCCESS) {
							$.modal.closeAll();
							$.modal.alertSuccess(result.msg);
							$.table.refresh();
						} else if (result.code == web_status.WARNING) {
							$.modal.enable();
							$.modal.alertWarning(result.msg);
						} else {
							$.modal.enable();
							$.modal.alertError(result.msg);
						}
						$.modal.closeLoading();
					}
				});
			}
	    }
	</script>
</body>

</html>
